package top.banner.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.banner.service.JDContentService;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author XGL
 */
@RestController
@RequestMapping
public class JDContentController {

    @Resource
    private JDContentService jdContentService;

    @GetMapping("/parse/{keyword}")
    public Boolean parse(@PathVariable String keyword) {
        return jdContentService.parseJDContent(keyword);
    }


    @GetMapping("/search/{keyword}/{page}/{size}")
    public List<Map<String, Object>> search(@PathVariable String keyword,
                                            @PathVariable int page,
                                            @PathVariable int size) {

        return jdContentService.searchPage(keyword, page, size);
    }
}
